<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Class: BlockPy</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Class: BlockPy</h1>

    




<section>

<header>
    
        <h2>BlockPy</h2>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    

    <h4 class="name" id="BlockPy"><span class="type-signature"></span>new BlockPy<span class="signature">(settings, assignment, submission, programs)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Creates an instance of BlockPy
</div>







    <h5>This:</h5>
    <ul><li>{<a href="BlockPy.html">BlockPy</a>}</li></ul>



    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>settings</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">User level settings (e.g., what view mode, whether to mute semantic errors, etc.)</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>assignment</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">Assignment level settings (data about the loaded assignment, user, submission, etc.)</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>submission</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">Unused parameter.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>programs</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">Includes the source code of any programs to be loaded</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line49">line 49</a>
    </li></ul></dd>
    

    

    

    
</dl>
















    
    </div>

    

    

    

     

    

    
        <h3 class="subsection-title">Members</h3>

        
            
<h4 class="name" id=".DEFAULT_MODULES"><span class="type-signature">(static) </span>DEFAULT_MODULES<span class="type-signature"> :Array.&lt;String></span></h4>




<div class="description">
    The default modules to make available to the user.
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Array.&lt;String></span>


        </li>
    </ul>





<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line242">line 242</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id="initComponents"><span class="type-signature"></span>initComponents<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Initializes each of the relevant components of BlockPy. For more information,
consult each of the component's relevant JS file in turn.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line289">line 289</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="initDevelopment"><span class="type-signature"></span>initDevelopment<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Initiailizes certain development data, useful for testing out new modules in
Skulpt.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line331">line 331</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="initInterface"><span class="type-signature"></span>initInterface<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Initializes the User Inteface for the instance, by loading in the
HTML file (which has been manually encoded into a JS string using
the build.py script). We do this because its a giant hassle to keep
HTML correct when it's stored in JS strings. We should look into
more sophisticated templating features, probably.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line271">line 271</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="initMain"><span class="type-signature"></span>initMain<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Initializes the BlockPy object by initializing its interface,
model, and components.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line253">line 253</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="initModel"><span class="type-signature"></span>initModel<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Applys the KnockoutJS bindings to the model, instantiating the values into the
HTML.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line281">line 281</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="reportError"><span class="type-signature"></span>reportError<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Redundant method for reporting an error. If this is used anywhere, it should be
converted to direct calls to components.feedback.
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line341">line 341</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
            

    

    <h4 class="name" id="setCode"><span class="type-signature"></span>setCode<span class="signature">(code, name<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>

    



<div class="description">
    Helper function for setting the current code, optionally in the given filename.
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>code</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last">The new Python source code to set.</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                

                
                    &lt;nullable><br>
                

                
                </td>
            

            

            <td class="description last">An optional filename (e.g,. '__main__') to update. Defaults to the currently selected filename.</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line357">line 357</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    - whether the code was updated (i.e. there was a diff between new and old).
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id="turnOnHacks"><span class="type-signature"></span>turnOnHacks<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Function for running any code that fixes bugs and stuff upstream.
Not pleasant that this exists, but better to have it isolated than
just lying about randomly...
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="main.js.html">main_v4.js</a>, <a href="main.js.html#line372">line 372</a>
    </li></ul></dd>
    

    

    

    
</dl>
















        
    

    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BlockPy.html">BlockPy</a></li><li><a href="BlockPyCorgis.html">BlockPyCorgis</a></li><li><a href="BlockPyDialog.html">BlockPyDialog</a></li><li><a href="BlockPyEditor.html">BlockPyEditor</a></li><li><a href="BlockPyEngine.html">BlockPyEngine</a></li><li><a href="BlockPyEnglish.html">BlockPyEnglish</a></li><li><a href="BlockPyFeedback.html">BlockPyFeedback</a></li><li><a href="BlockPyHistory.html">BlockPyHistory</a></li><li><a href="BlockPyPresentation.html">BlockPyPresentation</a></li><li><a href="BlockPyPrinter.html">BlockPyPrinter</a></li><li><a href="BlockPyServer.html">BlockPyServer</a></li><li><a href="BlockPyToolbar.html">BlockPyToolbar</a></li><li><a href="LocalStorageWrapper.html">LocalStorageWrapper</a></li><li><a href="PythonToBlocks.html">PythonToBlocks</a></li></ul><h3>Global</h3><ul><li><a href="global.html#BlockPyInterface">BlockPyInterface</a></li><li><a href="global.html#cloneNode">cloneNode</a></li><li><a href="global.html#encodeHTML">encodeHTML</a></li><li><a href="global.html#expandArray">expandArray</a></li><li><a href="global.html#EXTENDED_ERROR_EXPLANATION">EXTENDED_ERROR_EXPLANATION</a></li><li><a href="global.html#indent">indent</a></li><li><a href="global.html#instructor_module">instructor_module</a></li><li><a href="global.html#prettyPrintDateTime">prettyPrintDateTime</a></li><li><a href="global.html#randomInteger">randomInteger</a></li><li><a href="global.html#set_button_loaded">set_button_loaded</a></li><li><a href="global.html#timerGuard">timerGuard</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Mar 26 2017 09:45:04 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>